<?php if ( ! defined('BASEPATH')) exit('This file does not run directly. Sorry.'); ?>
<?php
/**
 * Kalaisoo.
 *
 * A lightweight no-framework framework written in PHP.
 *
 * @package Kalaisoo
 * @author $Author: info@sah-company.com $
 */
?>
<?php
/**
 * Include the partial template that holds doctype, html, head with metas and such.
 */
$this->view('shared/head');
?>
<?php
/**
 * Include the partial template that holds avatar and navigation.
 */
$this->view('shared/avatar');
?>
<?php
/**
 * Include the partial template that holds the toolbar.
 */
$this->view('shared/toolbar');
?>
<?php
/**
 * Include the partial template that displays the header of a record.
 */
$this->view('shared/editor/header');
?>

<section class="form">
	<header>
		<h1><?php echo __('user_avatar'); ?></h1>
		<?php
		/**
		 * Include the partial template that displays the tools.
		 */
		$this->view('shared/editor/toolbar');
		?>
	</header>

<?php
/**
 * output the form.
 */
echo formOpen('loadandcrop', $url, array('enctype' => 'multipart/form-data', 'autocomplete' => 'off'));
?>
	<div>
		<input type="hidden" id="x" name="x" value="" />
		<input type="hidden" id="y" name="y" value="" />
		<input type="hidden" id="x2" name="x2" value="" />
		<input type="hidden" id="y2" name="y2" value="" />
		<input type="hidden" id="w" name="w" value="" />
		<input type="hidden" id="h" name="h" value="" />
	</div>
	<fieldset>
		<legend><?php echo __('user_avatar_legend'); ?></legend>
		<div class="row avatar">
			<label><?php echo __('user_avatar_label'); ?></label>
		<?php
		if ($record->avatar):
		?>
			<img
				src="<?php echo ahref(Registry::instance()->config['uploads']['path'].'/'.$record->avatar.'?'.time()); ?>"
				alt=""
				id="avatar" />
			<p class="help"><?php echo __('user_avatar_help'); ?></p>
		<?php
		else:
		?>
			<div style="width: 480px; height: 480px; background-color: rgb(222, 222, 222);">
			</div>
			<p class="help"><?php echo __('user_avatar_upload_first_help'); ?></p>
		<?php
		endif;
		?>
		</div>
		<div class="row upload">
			<label for="uploaded_file"><?php echo __('user_uploaded_file_label'); ?></label>
<?php
echo fileUpload('uploaded_file', null, array('id' => 'uploaded_file', 'accept' => 'image/jpeg'));
?>
			<p class="help"><?php echo __('user_uploaded_file_help'); ?></p>
		</div>
	</fieldset>
	<fieldset>
		<legend><?php echo __('buttons'); ?></legend>
<?php
echo submit('submit', $submit, array('id' => 'submit', 'class' => 'button default'));
?>
	</fieldset>
<?php
echo formClose();
?>

</section>

<?php
/**
 * Include the partial template that closes all tags opened in @see views/shared/head.
 */
$this->view('shared/foot');
?>